package com.example.lib_base.base.activity

import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding

abstract class BaseBindingActivity<B : ViewDataBinding> : BaseActivity() {

    /**
     * baseDataBinding
     */
    protected lateinit var binding: B
    private set

    override fun initContentView() {
        injectDataBinding()
    }

    private fun injectDataBinding() {
        binding = DataBindingUtil.setContentView(this, getLayoutId())
        binding.lifecycleOwner = this
    }

    override fun onDestroy() {
        binding.unbind()
        super.onDestroy()
    }
}